/* eslint-disable */
import xhr from '@http/http'

// 创建应用
export const createAppUsingPOST = (app) => xhr.POST(`./api/app`, app)

// 获取应用列表-分页
export const findAppByAppQueryUsingPOST = (appQuery) => xhr.POST(`./api/app/page`, appQuery)

// 查询某应用下可用的菜单
export const findMenuByRoleIdAndAppIdUsingGET = (appId) => xhr.GET(`./api/app/${appId}/menu`)

// 删除应用
export const deleteAppUsingDELETE = (id) => xhr.DELETE(`./api/app/${id}`)

// 获取某一个应用信息
export const getAppUsingGET = (id) => xhr.GET(`./api/app/${id}`)

// 修改应用
export const updateAppUsingPUT = (id, data) => xhr.PUT(`./api/app/${id}`, data)

// 获取某一个应用的按钮
export const findButtonByAppIdUsingGET = (id, page, size) => xhr.GET(`./api/app/${id}/buttons?page=${page}&size=${size}`)

// 获取某一个应用的路由
export const findRouterByAppIdUsingGET = (id, page, size) => xhr.GET(`./api/app/${id}/routers?page=${page}&size=${size}`)

// 获取某一个应用的非菜单路由
export const getRouterNotMeauGET = (id) => xhr.GET(`./api/app/${id}/baseRouter`)

// 创建按钮
export const createButtonUsingPOST = (button) => xhr.POST(`./api/button`, button)

// 获取按钮列表-分页
export const findButtonByButtonQueryUsingPOST = (buttonQuery) => xhr.POST(`./api/button/page`, buttonQuery)

// 删除按钮
export const deleteButtonUsingDELETE = (id) => xhr.DELETE(`./api/button/${id}`)

// 修改按钮
export const updateButtonUsingPUT = (id, data) => xhr.PUT(`./api/button/${id}`, data)

// 删除按钮的资源
export const deleteButtonAndResourcesRelationUsingDELETE = (id, resourceIds) => xhr.DELETE(`./api/button/${id}/resources`, resourceIds)

// 删除路由的资源
export const deleteButtonAndRouterRelationUsingDELETE = (id, routerIds) => xhr.DELETE(`./api/button/${id}/routers`, routerIds)

// 创建资源
export const createResourceUsingPOST = (resource) => xhr.POST(`./api/resource`, resource)

// 获取资源列表-分页
export const findResourceByResourceQueryUsingPOST = (resourceQuery) => xhr.POST(`./api/resource/page`, resourceQuery)

// 删除资源
export const deleteResourceUsingDELETE = (id) => xhr.DELETE(`./api/resource/${id}`)

// 修改资源
export const updateResourceUsingPUT = (id, data) => xhr.PUT(`./api/resource/${id}`, data)

// 获取某一个资源信息
export const getResourceUsingGET = (id) => xhr.GET(`./api/resource/${id}`)

// 添加角色
export const createRoleUsingPOST = (role) => xhr.POST(`./api/role`, role)

// 修改角色
export const updateRoleUsingPUT = (id, role) => xhr.PUT(`./api/role/${id}`, role)


// 获取角色列表-分页
export const findRoleByRoleQueryUsingPOST = (roleQuery) => xhr.POST(`./api/role/page`, roleQuery)

// 删除角色
export const deleteRoleUsingDELETE = (id) => xhr.DELETE(`./api/role/${id}`)

// 查询某个角色下的所有应用
export const createRoleAndAppRelationUsingGET = (id) => xhr.GET(`./api/role/${id}/apps`)

// 角色添加应用
export const createRoleAndAppRelationUsingPOST = (id, appIds) => xhr.POST(`./api/role/${id}/apps`, appIds)

// 角色删除应用
export const delRoleAndAppRelationUsingDELETE = (id, appIds) => xhr.DELETE(`./api/role/${id}/apps`, appIds)


// 为某角色授权某应用的菜单、路由
export const createRoleAndRouterRelationUsingPOST = (roleId, routerIds) => xhr.POST(`./api/role/${roleId}/router`, routerIds)

// 查询某角色在某应用下可用的菜单
export const getMeauByAppRole = (roleId, appId) => xhr.GET(`./api/role/${roleId}/${appId}/menu`)

// 查询某角色在某应用下非菜单路由
export const getRouterByAppRole = (roleId, appId) => xhr.GET(`./api/role/${roleId}/${appId}/router`)

// 某角色某应用取消某路由
export const findRouterByRoleIdAndAppIdUsingDELETE = (roleId, routerIds) => xhr.DELETE(`./api/role/${roleId}/router`, routerIds)

// 创建路由
export const createRouterUsingPOST = (router) => xhr.POST(`./api/router`, router)

// 获取路由信息-分页
export const findRouterQueryByRoleQueryUsingPOST = (routerQuery) => xhr.POST(`./api/router/page`, routerQuery)

// 删除路由
export const deleteRouterUsingDELETE = (id) => xhr.DELETE(`./api/router/${id}`)

// 修改路由
export const updateRouterUsingPUT = (id, routerQuery) => xhr.PUT(`./api/router/${id}`, routerQuery)

// 路由删除按钮
export const deleteRouterAndButtonRelationUsingDELETE = (id, buttonIds) => xhr.DELETE(`./api/router/${id}/buttons?page=${page}&size=${size}`, buttonIds)

// 获取某个路由下面的按钮
export const getButtonsByRouterId = (id, page, size) => xhr.GET(`./api/router/${id}/buttons?page=${page}&size=${size}`)


// 路由删除资源
export const deleteRouterAndResourcesRelationUsingDELETE = (id, resourceIds) => xhr.DELETE(`./api/router/${id}/resources`, resourceIds)

// 路由添加资源
export const addRouterAndResourcesRelationUsingPOST = (id, resourceIds) => xhr.POST(`./api/router/${id}/resources`, resourceIds)

// 按钮添加资源
export const addButtonAndResourcesRelationUsingPOST = (id, resourceIds) => xhr.POST(`./api/button/${id}/resources`, resourceIds)

// 查询某一个路由的资源
export const getHasResourceByRouter = (id) => xhr.GET(`./api/router/${id}/resources`)

// 查询某一个按钮的资源
export const getHasResourceByButton = (id) => xhr.GET(`./api/button/${id}/resources`)


// errorHtml
export const errorHtmlUsingPATCH = () => xhr.PATCH(`./error`)

// 检查角色是否有权限访问接口
export const findResourceByResourceQueryUsingPOST_1 = (roleResourceQuery) => xhr.POST(`./open/roles/resource/check`, roleResourceQuery)

// 获取应用分类树形结构

export const getClassTreePOST = () => xhr.GET(`./api/app/category/tree`)

// 获取应用和应用分类树形结构

export const getCategoryAndAppTree = () => xhr.GET(`./api/app/category/categoryOrAppTree`)

// 获取某一个应用分类信息
export const getClassCategoryGET = (id) => xhr.GET(`./api/app/category/${id}`)

// 删除某一个应用分类信息
export const delClassCategoryDELETE = (id) => xhr.DELETE(`./api/app/category/${id}`)

// 修改应用分类 PUT /api/app/category/{id}
export const updateClassCategoryPUT = (id, data) => xhr.PUT(`./api/app/category/${id}`, data)

// 查询分类下所有应用列表
export const getAppAllByClassIdPOST = (data) => xhr.POST(`./api/app/all`, data)

// 应用分类的控制层，新增分类
export const appcategoryInsertCategory = (data) => xhr.POST(`./api/app/category`, data)

// 为某一个角色添加按钮
export const setButtonsForRole = (roleId, buttonIds) => xhr.POST(`./api/role/${roleId}/buttons`, buttonIds)

// 为某一个角色删除按钮
export const delButtonsForRole = (roleId, buttonIds) => xhr.DELETE(`./api/role/${roleId}/buttons`, buttonIds)

// 获取某角色某应用下已添加按钮
export const getHasButtonsForRoleAndApp = (roleId, appId, routerId) => xhr.GET(`./api/role/${roleId}/${appId}/${routerId}/button`)

// 获取用户角色
export const getUserRoleBySn = (sn) => xhr.GET(`./api/user/${sn}/roles`)

// 删除用户角色
export const deleteUserRoleBySn = (sn, roles) => xhr.DELETE(`./api/user/${sn}/roles`, roles)

// 给用户添加角色
export const addRoleForUserBySn = (sn, roles) => xhr.POST(`./api/user/${sn}/roles`, roles)

// http.POST('./api/manager/list', data)
export const getMangerList = (data) => xhr.POST(`./api/manager/userAndRole`, data)



